//
//  SecondViewController.m
//  UI03_UIViewController
//
//  Created by aaaaaa on 16/6/7.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "SecondViewController.h"
#import "CustomerUIViewController.h"

@interface SecondViewController ()

@end

@implementation SecondViewController

- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        NSLog(@"second %d, %s", __LINE__, __FUNCTION__);
    }
    return self;
}

- (void)loadView{
    [super loadView];
    NSLog(@"second %d, %s", __LINE__, __FUNCTION__);
}



- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor blueColor];
    NSLog(@"second %d, %s", __LINE__, __FUNCTION__);
    [self createButton];
}

- (void)createButton{
    UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
    button.backgroundColor = [UIColor yellowColor];
    button.frame = CGRectMake(100, 100, 80, 30);
    [button setTitle:@"上一页" forState:UIControlStateNormal];
    [button addTarget:self action:@selector(nextAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button];
}
- (void)nextAction:(UIButton *)button{
    CustomerUIViewController *customerVC = [[CustomerUIViewController alloc] init];
    [self presentViewController:customerVC animated:YES completion:^{
    }];
    [customerVC release];
}

- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    NSLog(@"second %d, %s", __LINE__, __FUNCTION__);
}

- (void)viewDidAppear:(BOOL)animated{
    [super viewDidAppear:animated];
    NSLog(@"second %d, %s", __LINE__, __FUNCTION__);
}


- (void)viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear:animated];
    NSLog(@"second %d, %s", __LINE__, __FUNCTION__);
}

- (void)viewDidDisappear:(BOOL)animated{
    [super viewDidDisappear:animated];
    NSLog(@"second %d, %s", __LINE__, __FUNCTION__);
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
